<?php include PATH_TPL."/admin/tpl.header.phtml"?>
<div class="main-container inner">
    <div class="main-content">
        <div class="container-fluid">
            <div class="row bt">
                <div class="col-lg-12 bg">
                    <ol class="breadcrumb">
                        <li class="active">
                            <i class="fa  fa-fw fa-reorder"></i>产品详情
                        </li>
                    </ol>
                </div>
            </div>
            <div id="page-wrapper">
                <div class="container-fluid col-md-7 col-sx-12">
                    <form action="/admin_policy/edit" method="post" enctype="multipart/form-data">
                        <div class="form-group ">
                            <label for="name"><strong>保险公司</strong></label>
                            <input type="text" placeholder="反馈人名字" id="name" class="form-control" name="name" value="<?=$tHCTRow['INSURANCE_NAME']?>" readonly>
                        </div>
                        <div class="form-group">
                            <label for="phone"><strong>保单号</strong></label>
                            <input type="text" placeholder="保单号" id="phone" class="form-control" name="policyno" value="<?=$tHCTRow['POLICYNO']?>" readonly>
                        </div>
                        <div class="form-group">
                            <label for="policy_name"><strong>投保单位</strong></label>
                            <input type="text" placeholder="投保单位" id="policy_name" class="form-control" name="policy_name" value="<?=$tHCTRow['POLICYNAME']?>" readonly>
                        </div>
                        <div class="form-group">
                            <label for="insurance_type"><strong>险种名称</strong></label></br>
                            <input type="text" placeholder="险种名称" name="product_name" value="<?=$tHCTRow['product_name']?>">
                        </div>
                        <div class="form-group">
                            <label for="ziliao"><strong>提交资料</strong></label></br>
                            <?foreach($tDataType as $tKey => $tVal){?>
                            <input type="checkbox" name="case[]" value="<?=$tKey?>" <?php if(strstr($tPRow['datatype'],$tKey)){echo "checked";}?>>&nbsp;<span><?=$tVal?></span>
                            <?}?>
                        </div>
						<input type="hidden" name="newarr" value="">
                        <div class="form-group" style="">
                            <label for="ziliao"><strong>已选资料预览(已经勾选的资料顺序显示,红色字体的为必选资料类型)</strong></label></br>
							<?foreach($tType as $tKey1=>$tRow1){?>
								<button type="button" disabled style="<?php if(!empty(strstr($tBType,$tRow1))){echo 'color:red';}?>"><?=$tRow1?></button>
							<?}?>
                        </div>
                        <div class="form-group test" style="display:none;">
                            <label for="ziliao"><strong>被选资料预览(正在勾选的资料顺序显示)</strong></label></br>
                        </div>
                        <div class="form-group test2" style="display:none;">
                            <label for="ziliao"><strong>必选资料(勾选为必选)</strong></label></br>
                        </div>
                        <div class="form-group">
                            <label for="ziliao"><strong>保单属组</strong></label></br>
                            <table>
                            <tr><td>属组编码</td><td>属组描述 </td></tr>
                            <?foreach($tCTPDatas as $tKey => $tRow){?>
                            <tr><td><?=$tRow['policygroup']?></td><td><input type='text' value='<?=$tRow['policygroupremak']?>' name='policygroupremak[<?=$tRow['policygroup']?>]' /></td></tr>
                            <?}?>
                            </table>
                        </div>

                        <!-- <div>
                            <label for="introduce"><strong>产品介绍</strong></label></br>
                            <textarea name="introduce" style="width:588px;height:178px" clas="form-control" placeholder="" value="<?=$tPRow['introduce']?>"><?=$tPRow['introduce']?></textarea>
                        </div> -->
                        <div class="form-group">
                            <label for="introduce"><strong>产品介绍</strong></label></br>
                            <!-- 加载编辑器的容器 -->
                            <script id="container" name="introduce" type="text/plain"><?=htmlspecialchars_decode($tPRow['introduce'])?></script>
                        </div>
                        <div class="form-group">
                            <label for="sessions"><strong>赔付须知</strong></label></br>
                            <script id="notice" name="notice" type="text/plain">
<?if(!empty($tPRow['notice'])){?>
<?=htmlspecialchars_decode($tPRow['notice'])?>
<?}else{?>
<p>1.此平台仅提供健康险自助理赔付(暂不包含身故及重疾理赔申请)。</p>2.请您按提示完整、准确提交各类资料影像。</p><p>3.请您确认医疗费用发生时间在保单承保期间内。</p><p>4.此平台仅提供健康险自助理赔付(暂不包含身故及重疾理赔申请)。</p><p>5.若您提供之资料无法满足理赔需求，平台将提示您补充资料，请您配合及时补交；超期未提供将视为您自动放弃此次理赔申请。</p>
<?}?>

                            </script>

<span></span>
                        </div>
                       <input type='hidden' value='<?=$tId?>' name='id'/>
                        <button class="btn btn-primary demo_2" type="button" id="submit">保存</button>
                    </form>
                </div>
            </div>
        </div>
        <div class="subviews">
            <div class="subviews-container"></div>
        </div>
    </div>
    <!-- end: PAGE -->
</div>
<!-- end: MAIN CONTAINER -->
<script type="text/javascript" src="/plugins/jquery-ui-1.11.4/jquery-ui.min.js"></script>
<script type="text/javascript" src="/plugins/datetimepicker/js/bootstrap-datetimepicker.js"></script>
<script type="text/javascript" src="/plugins/datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js" charset="UTF-8"></script>
<script type="text/javascript">
$('.datetimeEnd').datetimepicker({
    language:  'zh-CN',
    weekStart: 1,
    todayBtn:  1,
    autoclose: 1,
    todayHighlight: 1,
    startView: 2,
    minView: 0,
    format:'yyyy-mm-dd hh:ii',
    pickerPosition: "top-right",
    forceParse: 0
});
</script>
<!-- 配置文件 -->
<script type="text/javascript" src="/plugins/ueditor/ueditor.config.js"></script>
<!-- 编辑器源码文件 -->
<script type="text/javascript" src="/plugins/ueditor/ueditor.all.js"></script>
<!-- 实例化编辑器 -->
<script type="text/javascript">
    var ue = UE.getEditor('container',{
        toolbars: [
            ['fullscreen', 'source', 'undo', 'redo','bold', 'italic', 'underline','fontborder', 'strikethrough', '|','simpleupload', 'insertimage','attachment','emotion','link','unlink', '|', 'removeformat', 'formatmatch', 'autotypeset', 'blockquote','searchreplace', 'pasteplain', '|', 'forecolor', 'backcolor', 'insertorderedlist', 'insertunorderedlist', 'selectall', 'cleardoc'],
            ['inserttable','insertrow', 'insertcol','mergeright', 'mergedown','deleterow', 'deletecol','splittorows','splittocols', 'splittocells','deletecaption','inserttitle', 'mergecells', 'deletetable','insertparagraphbeforetable', 'paragraph','fontsize','fontfamily']
        ],
        initialFrameHeight:260,
        zIndex:1000,
    });
    var ue = UE.getEditor('notice',{
        toolbars: [
            ['fullscreen', 'source', 'undo', 'redo','bold', 'italic', 'underline','fontborder', 'strikethrough', '|','simpleupload', 'insertimage','attachment','emotion','link','unlink', '|', 'removeformat', 'formatmatch', 'autotypeset', 'blockquote','searchreplace', 'pasteplain', '|', 'forecolor', 'backcolor', 'insertorderedlist', 'insertunorderedlist', 'selectall', 'cleardoc'],
            ['inserttable','insertrow', 'insertcol','mergeright', 'mergedown','deleterow', 'deletecol','splittorows','splittocols', 'splittocells','deletecaption','inserttitle', 'mergecells', 'deletetable','insertparagraphbeforetable', 'paragraph','fontsize','fontfamily']
        ],
        initialFrameHeight:260,
        zIndex:1000,
    });

</script>

<script>
$(function(){
	var newarr = [];
    var options={
        beforeSubmit : showRequest,    // 提交前的回调函数
        success : showResponse,    // 提交后的回调函数
        dataType : "json",    // html（默认）、xml、script、json接受服务器端返回的类型
    }
    function showRequest(formData, jqForm, options){
        return true;
    }
    function showResponse(responseText,statusText){
            cg_alert_edit(responseText,'/admin_policy','/admin_policy/edit?id=<?=$tId?>');
    }
    $('#submit').click(function() {
        $('form').ajaxSubmit(options);
        return false;
    });
    var a = [];
	var tstr = [];
	$("input[type='checkbox']:checked").each(function() {
    	a.push($(this).next('span').html());
		tstr.push($(this).val());
    });
	$("input[type='checkbox']").each(function(){
		$(this).on('click',function(){
			var arr = [];
			var tt = $(this).attr('value');
			if($(this).is(':checked') == true){
				$('.test').css('display','block');
				$('.test2').css('display','block');
				$('.test').append('<button class="'+tt+'">'+ziliao(tt)+'</button>');
				$('.test2').append('<input type="checkbox" name="bcase[]" value="'+tt+'" class="'+tt+'">'+ziliao(tt)+'');
			}else{
				$('.'+tt+'').remove();	
			}
			$('.test button').each(function(){
				arr.push($(this).attr('class'));
			});
			$('input[name="newarr"]').attr('value',arr);
		});
	});
	/*资料类别*/
	function ziliao(str){
		var strr = '';
		switch(str){
			case 'accountCertificate':return strr = '账户证明';break;
			case 'receipt':return strr = '收据';break;
			case 'applicantsOfIdentity':return strr = '申请人身份证明';break;
			case 'benificiaryOfIdentity':return strr = '受益人身份证明';break;
			case 'chargeList':return strr = '费用清单';break;
			case 'claimForm':return strr = '索赔申请';break;
			case 'clientsOfIdentity':return strr = '委托人身份证明';break;
			case 'dangerOfIdentity':return strr = '出险人身份证明';break;
			case 'disabilityAppraisal':return strr = '伤残鉴定术';break;
			case 'doorSign':return strr = '上门签收单';break;
			case 'handoverList':return strr = '交接清单';break;
			case 'idcard':return strr = '身份证';break;
			case 'identity':return strr = '身份证明';break;
			case 'medical':return strr = '病例';break;
			case 'medicalItem':return strr = '医疗资料';break;
			case 'medicalRecordsOfSpecialDiseases':return strr = '特种疾病病历';break;
			case 'other':return strr = '其他单据';break;
			case 'payeeOfIdentity':return strr = '领款人身份证明';break;
			case 'requisition':return strr = '索赔申请单';break;
			case 'withdrawalList':return strr = '退件清单';break;
		}
	}
    /*if($("input[type='checkbox']:checked").length != 0){
    	$('#sessions').html($('#sessions').html()+'6.申请赔付需提交'+a.join('、')+'。');
}*/
});

</script>
<?php include PATH_TPL."/admin/tpl.footer.phtml"?>
